// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1

Rectangle {

	
	function updateAll(timeStr, speedStr, distanceStr, satStr, tempStr, altStr, rainMode, crossMode, pFactor) {
		time.text = timeStr
		speed.text = speedStr
		distance.text = distanceStr
		sat.text = satStr
		temp.text = tempStr
		alt.text = altStr
		rain_icon.visible = rainMode
		crossMode_icon.visible = crossMode
		progressBar.height =  194 * pFactor
	}

	function updateTime(str) {
		time.text = str
	}
	
	function updateDistance(str) {
		distance.text = str
	}
	
	function updateSpeed(str) {
		speed.text = str
	}
	
	function updateSat(str) {
		sat.text = str
	}
	
	function updateProgress(number) {
		sat.text = progressBar.height * number
	}
	

  id: mainWindow
    width: 320
    height: 234
    gradient: Gradient {
        GradientStop {
            position: 0
            color: "#ffffff"
        }

        GradientStop {
            position: 1
            color: "#051066"
        }
    }
    StyledText {
        id: speed
        x: 92
        y: 60
        width: 215
        height: 140
        text: "---"
        anchors.top: parent.top
        anchors.topMargin: 62
        anchors.right: parent.right
        anchors.rightMargin: 13
        opacity: 1
        clip: false
        smooth: false
        font.pointSize: 96

        StyledText {
            id: kmh
            x: 164
            y: 128
            width: 42
            height: 20
            text: "km/h"
            font.bold: false
            font.pixelSize: 18
        }

        StyledText {
            id: distance
            x: 6
            y: 120
            text: "---.-"
            font.pixelSize: 32
        }
    }

    Rectangle {
        id: progressArea
        x: 14
        y: 20
        width: 60
        height: 200
        color: "#ffffff"
        border.width: 2
        border.color: "#000000"
        clip: false
        smooth: false
        opacity: 0.850

        Rectangle {
            id: progressBar
            y: 3
            width: 54
            height: 194
            anchors.left: parent.left
            anchors.leftMargin: 3
            anchors.bottom: parent.bottom
            anchors.bottomMargin: 3
            border.width: 0
            gradient: Gradient {
                GradientStop {
                    position: 0
                    color: "#b95656"
                }

                GradientStop {
                    position: 1
                    color: "#5dfd00"
                }
            }
            border.color: "#000000"
            clip: false
            smooth: false
            visible: true
            opacity: 1
        }
    }

    StyledText {
        id: time
        x: 226
        y: 7
        width: 86
        height: 23
        text: "--:--:--"
    }

    Image {
        id: sat_icon
        x: 82
        y: 32
        width: 32
        height: 32
        source: "icons/satellite.png"
    }

	Image {
        id: temp_icon
        x: 142
        y: 29
        width: 12
        height: 32
        source: "icons/temperature.png"
    }

	Image {
        id: alt_icon
        x: 216
        y: 32
        width: 30
        height: 30
        source: "icons/mountain.png"
    }

    StyledText {
        id: sat
        x: 112
        y: 37
        text: "--"
    }

    StyledText {
        id: temp
        x: 160
        y: 37
        width: 53
        height: 25
        text: "--°C"
    }

    StyledText {
        id: alt
        x: 244
        y: 37
        width: 69
        height: 25
        text: "----m"
    }
    
    Image {
        id: rain_icon
        x: 110
        y: 4
        width: 32
        height: 32
        visible: true
        source: "icons/rain.png"
    }

    Image {
        id: crossMode_icon
        x: 170
        y: 4
        width: 32
        height: 32
        source: "icons/offRoad.png"
    }


	/*
    Timer {
         id: simpletimer
         interval: 100
         repeat: true
         running: true
         onTriggered: progressBar.height > 0.0 ? progressBar.height -= 1.0 : progressBar.height = 194
     }
     */
}

